﻿(function (window) {
    yjqUtils = {

    }
    yjqUtils.iframe = {
        add: function (href, rel, id) {
            /// <summary>
            /// 添加iframe
            /// </summary>
            /// <param name="href">超链接的href</param>
            /// <param name="rel">超链接的rel</param>
            /// <param name="id">超链接的id</param>
            if ($(href).find("iframe").length == 0) {
                var openout = $("#tp" + id), iframetab = $("#tpiframe" + id);
                if (openout.length == 0 && iframetab.length == 0) {
                    var html = [];
                    html.push('<div>');
                    html.push('<div id="tp' + id + '"></div><iframe scrolling=no  id="tpiframe' + id + '" src="' + rel + '"/>');
                    html.push('</div>');
                    $(href).append(html.join(""));
                    openout = $("#tp" + id), iframetab = $("#tpiframe" + id);
                    openout.css({
                        'float': 'right',
                        'position': 'relative',
                        'top': '-28',
                        'left': '-5'
                    });
                    iframetab.css({
                        'width': '100%',
                        'height': 'auto',
                        'border': '0',
                        'margin': '0',
                        'position': 'relative',
                        'top': '0',
                        'background': 'white'
                    });
                }
                $(href).find("iframe").height($(window).height() - 80);
            }
        }
    }
    window.yjqUtils = yjqUtils;
})(window);
